package net.metashare.grah

import net.metashare.grah.logic.Predicate
import net.metashare.grah.logic.True
import net.metashare.grah.meta.MetaContext
import net.metashare.grah.operation.Operation

/**
 *
 * @author dsherema
 */
class ResultGraph extends CompoundGraph {

  def MutableGraph output
  def Operation operation
  def CompoundGraph inputs = new CompoundGraph()


  def ResultGraph(Graph output, Graph inputs) {
    this(output, (Operation) null, inputs)
  }

  def ResultGraph(Graph output, Operation operation, Graph input) {
    this.output = output
    this.operation = operation
    this.inputs = new CompoundGraph()
    this.inputs.add(input)
  }

  def ResultGraph(Graph output, Operation operation, List<Graph> inputs) {
    this.output = output
    this.operation = operation
    this.inputs = new CompoundGraph()
    inputs.each() { this.inputs.add(it) }
  }


  def List<Node> nodes(Predicate p = True.instance) {
    return output.nodes(p)
  }

  def List<Edge> edges(Predicate p = True.instance) {
    return output.edges(p)
  }

  def MetaContext context() {
    return null;  //To change body of implemented methods use File | Settings | File Templates.
  }

}

